import request from '@/api/request';
import { AxiosPromise } from 'axios';
import { GrowthQuery, GrowthPageResult, GrowthVO } from './types';

/**
 * 用户成长表分页列表
 *
 * @param queryParams
 */
export function pageGrowth(queryParams: GrowthQuery): AxiosPromise<GrowthPageResult> {
  return request({
    url: '/api/v1/growth/page',
    method: 'get',
    params: queryParams
  });
}

/**
 * 用户成长表表单数据
 *
 * @param id
 */
export function getGrowthById(id: number): AxiosPromise<GrowthVO> {
  return request({
    url: `/api/v1/growth/${id}`,
    method: 'get'
  });
}

/**
 * 新增用户成长表
 *
 * @param data
 */
export function saveGrowth(data: GrowthVO) {
  return request({
    url: '/api/v1/growth',
    method: 'post',
    data
  });
}

/**
 * 删除用户成长表
 */
export function deleteGrowth(ids: number[]) {
  return request({
    url: '/api/v1/growth',
    method: 'delete',
    data: ids
  });
}
